home *** CD-ROM | disk | FTP | other *** search
- /* ==========================================================================
- **
- ** VSlider.c
- ** ©1991 WILLISoft
- **
- ** ==========================================================================
- */
-
- #include <stdio.h>
- #include "minmax.h"
- #include "Vslider.h"
- #include "VSliderClass.h"
- #ifndef __GNUC__
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/graphics_protos.h>
- #endif
- #ifdef __GNUC__
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #include <proto/graphics.h>
- #endif
- #ifdef __SASC
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #include <proto/graphics.h>
- #endif
- #include "amigamem.h"
-
-
- tPoint VSlider_AskSize( VSlider *self,
- PIXELS Width,
- PIXELS Height )
- {
- tPoint size;
-
- size.x = MAX( Width, 10 );
- size.y = MAX( Height, 20 );
-
- return size;
- }
-
-
-
- LONG VSlider_Value( VSlider *self )
- {
- return self->Prop.VertPot;
- }
-
-
- USHORT VSlider_KnobSize( VSlider *self )
- {
- return self->Prop.VertBody;
- }
-
-
- LONG VSlider_SetValue( VSlider *self, LONG value )
- {
- struct pcgWindow *window;
- struct PropInfo propinfo;
- USHORT position;
-
- position = value;
- propinfo = self->Prop;
-
- if( ( window = InteractorWindow( (Interactor *)self ) ) &&
- ( window->Window ) )
- {
- NewModifyProp( &self->eg.g, window->Window, NULL, propinfo.Flags,
- propinfo.HorizPot, position,
- propinfo.HorizBody, propinfo.VertBody,
- 1 );
- }
- else
- {
- self->Prop.VertPot = position;
- }
-
- return position;
- }
-
-
- USHORT VSlider_SetKnobSize( VSlider *self, USHORT knobsize )
- {
- struct pcgWindow *window;
- struct PropInfo propinfo;
-
- propinfo = self->Prop;
-
- if( ( window = InteractorWindow( (Interactor *)self ) ) &&
- ( window->Window ) )
- {
- NewModifyProp( &self->eg.g, window->Window, NULL, propinfo.Flags,
- propinfo.HorizPot, propinfo.VertPot,
- propinfo.HorizBody, knobsize,
- 1 );
- }
- else
- {
- self->Prop.VertBody = knobsize;
- }
-
- return knobsize;
- }
-
-
-
- BOOL VSlider_elaborated = FALSE;
-
- struct PositionerClass VSlider_Class;
-
- void VSliderClass_Init( struct PositionerClass *class )
- {
- SliderClass_Init( class );
- class->isa = SliderClass();
- class->ClassName = "VSlider";
- class->AskSize = (Point(*)(GraphicObject *, PIXELS, PIXELS))VSlider_AskSize;
- class->SetValue = (LONG(*)(Valuator *, LONG))VSlider_SetValue;
- class->Value = (LONG(*)(Valuator *))VSlider_Value;
- class->SetKnobSize = (USHORT(*)(Positioner *, USHORT))VSlider_SetKnobSize;
- class->KnobSize = (USHORT(*)(Positioner *))VSlider_KnobSize;
-
- }
-
-
- struct PositionerClass *VSliderClass( void )
- {
- if( ! VSlider_elaborated )
- {
- VSliderClass_Init( &VSlider_Class );
- VSlider_elaborated = TRUE;
- }
-
- return &VSlider_Class;
- }
-
-
- void VSlider_Init( VSlider *self,
- PIXELS LeftEdge,
- PIXELS TopEdge,
- PIXELS Width,
- PIXELS Height,
- pcg_3DPens Pens,
- char *label )
- {
- Point size;
-
- size = VSlider_AskSize( self, Width, Height );
-
- Slider_Init( self, LeftEdge, TopEdge, size.x, size.y, Pens );
- SetTitle( (GraphicObject *)self, label );
- SetTextAlignment( (GraphicObject *)self, tx_XCENTER | tx_BOTTOM | tx_OUTSIDE, STD_XPAD, STD_YPAD );
-
- self->eg.isa = VSliderClass();
- self->Prop.Flags |= FREEVERT;
- self->Prop.VertBody = 0x4000;
- }
-
-
-
-